﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<style type="text/css">
    .ui-jqgrid .table-bordered th {
        height: 52px !important;
    }
</style>
<script type="text/javascript">
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        $('select').bindSelect();
        $('#showTable input[type="text"]').attr("readonly", "readonly");
        $.ajax({
            type: 'GET',
            url: '/BOM/Product/GetPartsItemJson',
            data: { dh: $("#txtDH").val() },
            dataType: 'json',
            success: function (data) {
                $("#txtTX").val(data.TX);
                $("#txtAssembleLine").val(data.AssembleLine);
                $("#txtBB").val(data.BB);
                $("#txtLXD").val(data.LXD);
                $("#txtMC").val(data.MC);
                $("#txtZT").val(data.ZT);
                $("#txtMakeLine").val(data.MakeLine);
                $("#txtBC").val(data.BC);
                $("#txtCTH").val(data.CTH);
            }
        });
    }
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/BOM/Product/GetSingleNextJson",
            postData: { dh: $("#txtDH").val() },
            height: $(window).height() - 220,
            colModel: [
                { label: '位置号', name: 'WZH', width: 50, align: 'center', sortable: false, frozen: true },
                { label: '零件编号', name: 'DH', width: 120, align: 'left', sortable: false, frozen: true },
                { label: '零件名称', name: 'MC', width: 200, align: 'left', sortable: false, frozen: true },
                { label: '版本', name: 'BB', width: 40, align: 'center', sortable: false },
                { label: '版次', name: 'BC', width: 40, align: 'center', sortable: false },
                { label: '数量', name: 'SL', width: 80, align: 'right', sortable: false },
                { label: '类', name: 'LEI', width: 60, align: 'left', sortable: false },
                { label: '特征', name: 'TX', width: 40, align: 'center', sortable: false },
                { label: '状态', name: 'ZT', width: 40, align: 'center', sortable: false },
                { label: '装配<br />路线', name: 'AssembleLine', width: 40, align: 'center', sortable: false },
                { label: '制造路线', name: 'MakeLine', width: 240, align: 'left', sortable: false },
                { label: '技术更改单编号', name: 'LXD', width: 120, align: 'center', sortable: false },
                { label: '生效日期', name: 'StartDate', width: 120, align: 'center', sortable: false },
                { label: '失效日期', name: 'StopDate', width: 120, align: 'center', sortable: false },
                { label: '参考图号', name: 'CTH', width: 120, align: 'left', sortable: false },
                { label: '图幅', name: 'TF', width: 60, align: 'center', sortable: false },
                { label: '重量', name: 'ZL', width: 60, align: 'center', sortable: false },
                { label: '材料代码', name: 'CLDM', width: 80, align: 'center', sortable: false },
                { label: '分级', name: 'JF', width: 80, align: 'center', sortable: false }
            ],
            pager: "#gridPager",
            sortname: 'WZH asc,DH asc',
            viewrecords: true,
            rownumWidth: 40,
            onSelectRow: function (rowid) {
                var rowData = $gridList.jqGrid('getRowData', rowid);
                $('#txtCurrDH').val(rowData.DH);
            },
            ondblClickRow: function (rowid) {
                var rowData = $gridList.jqGrid('getRowData', rowid);
                //alert(rowData.DH);
                $('#txtCurrDH').val(rowData.DH);
                show_selector();
            }
        });
        $gridList.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        $gridList.jqGrid('setFrozenColumns');
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { dh: $("#txtDH").val(), number: $("#txtNumber").val(), name: $("#txtName").val(), assemble: $("#txtAssemble").val(), make: $("#txtMake").val() },
            }).trigger('reloadGrid');
            $('#txtCurrDH').val("");
        });
    }
    function btn_next() {
        var dh = $.trim($('#txtCurrDH').val());
        if (dh == "") {
            $.modalAlert('请先选择总成。', 'warning');
        } else {
            window.location.href = '/BOM/Product/SingleQueryNext?dh=' + dh;
        }
    }
    function btn_previous() {
        var dh = $.trim($('#txtCurrDH').val());
        if (dh == "") {
            $.modalAlert('请先选择总成。', 'warning');
        } else {
            window.location.href = '/BOM/Product/SingleQueryPrevious?dh=' + dh;
        }
    }
</script>
<div id="layout" style="height: 100%; width: 100%;">
    <form id="form1">
        <div style="padding: 12px 0 5px 0; padding-left: 15px; border-bottom: 1px solid #ccc; " class="line-table input-width-105">
            <div class="btn-group" style="margin-top:-9px;">
                零件编号<br /><input id="txtNumber" name="txtNumber" type="text" class="form-control" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                零件名称<br /><input id="txtName" name="txtName" type="text" class="form-control input-width-185" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                装配路线<br /><input id="txtAssemble" name="txtAssemble" type="text" class="form-control input-width-40" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                制造路线<br /><input id="txtMake" name="txtMake" type="text" class="form-control" /> &nbsp;
            </div>
            <div class="btn-group" style="">
                <a id="btn_search" class="btn btn-primary center-block" onclick=""><span class="glyphicon glyphicon-search"></span> 查询</a>
            </div>
            <div class="btn-group" style="float:right;">
                <a id="" class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span> 刷新</a>
                <a id="" class="btn btn-primary center-block" onclick="" href="/BOM/Product/SingleQuery"><span class="glyphicon glyphicon-th-list"></span> 目录</a>
                <a id="" class="btn btn-primary center-block" onclick="btn_next()"><span class="glyphicon glyphicon-plus"></span> 展开</a>
                <a id="" class="btn btn-primary center-block" onclick="btn_previous()"><span class="glyphicon glyphicon-minus"></span> 回归</a>
                <a id="" class="btn btn-primary center-block disabled" onclick=""><span class="glyphicon glyphicon-download"></span> 导出</a>
            </div>
        </div>
        <div id="showTable" style="padding: 5px 0; padding-left:5px; margin-right: 30px;" class="line-table input-width-140">
            <table class="form">
                <tr>
                    <th class="formTitle" style="width:60px">总成系统</th>
                    <td class="formValue" style="width:210px;">
                        <input id="txtDH" name="txtDH" type="text" class="form-control" value="@ViewBag.dh" />
                    </td>
                    <th class="formTitle" style="width:50px">特征</th>
                    <td class="formValue" style="width:56px;">
                        <input id="txtTX" name="txtTX" type="text" class="form-control input-width-40" />
                    </td>
                    <th class="formTitle" style="width:50px">装配</th>
                    <td class="formValue" style="width:185px;">
                        <input id="txtAssembleLine" name="txtAssembleLine" type="text" class="form-control input-width-40" />
                    </td>
                    <th class="formTitle" style="width:50px">版本</th>
                    <td class="formValue" style="width:70px;">
                        <input id="txtBB" name="txtBB" type="text" class="form-control input-width-40" />
                    </td>
                    <th class="formTitle" style="width:60px">更改单号</th>
                    <td class="formValue">
                        <input id="txtLXD" name="txtLXD" type="text" class="form-control" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">总成名称</th>
                    <td class="formValue">
                        <input id="txtMC" name="txtMC" type="text" class="form-control input-width-210" />
                    </td>
                    <th class="formTitle">状态</th>
                    <td class="formValue">
                        <input id="txtZT" name="txtZT" type="text" class="form-control input-width-40" />
                    </td>
                    <th class="formTitle">制造</th>
                    <td class="formValue">
                        <input id="txtMakeLine" name="txtMakeLine" type="text" class="form-control input-width-185" />
                    </td>
                    <th class="formTitle">版次</th>
                    <td class="formValue">
                        <input id="txtBC" name="txtBC" type="text" class="form-control input-width-40" />
                    </td>
                    <th class="formTitle">参考图号</th>
                    <td class="formValue">
                        <input id="txtCTH" name="txtCTH" type="text" class="form-control" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
    <div style="height: 18px; line-height: 18px; font-size: 14px; font-weight: bold; padding-left: 8px;">总成展开结果：</div>
    <div style="">
        <input id="txtCurrDH" name="txtCurrDH" type="hidden" value="" />
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</div>

